package com.neuedu.corejava.ch9;

import java.util.Random;

import com.sun.org.apache.bcel.internal.generic.NEW;

public class MachClass {

	public static void main(String[] args) {
		//Math类，包含了常用的数学函数和数学常量
		//绝对值
		int a = Math.abs(-1111);
		System.out.println(a);
		
		double d = Math.abs(-11.1111);
		System.out.println(d);
		System.out.println("----------------------");
		System.out.println(Math.ceil(23.56));
		System.out.println(Math.ceil(23.36));
		System.out.println(Math.ceil(23.01));
		System.out.println("----------------------");
		System.out.println(Math.floor(23.56));
		System.out.println(Math.floor(23.36));
		System.out.println("----------------------");
		System.out.println(Math.round(23.56));
		System.out.println(Math.round(23.36));
		System.out.println("----------------------");
		System.out.println(Math.PI);
		
		//随机数		
		System.out.println(Math.random());//得到0-1之间的随机小数,不包含1
		System.out.println(new Random().nextInt(100));//不包含100
		//三角函数
		System.out.println(Math.cos(Math.PI/3));
		//开平方
		System.out.println(Math.sqrt(4));
	}

}
